package com.navinfo.platform.flink.cdc.dao;

import com.alibaba.fastjson.JSONObject;
import com.navinfo.platform.flink.cdc.util.DBUtils;

import java.io.Serializable;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

/**
 * 同步数据——逻辑删除的Dao
 */
public class DeleteDao implements Serializable {
    /**
     * 删除故障表数据同步
     */
    public void deleteHyFaultDetail(JSONObject before) throws SQLException {
        String delSql = "UPDATE ods_hy_fault SET del_flag = 1 WHERE id = ?";
        try (Connection conn = DBUtils.getConnection();
             PreparedStatement statement = conn.prepareStatement(delSql)) {
            statement.setObject(1, before.getLong("id"));
            statement.executeUpdate();
        }
    }

}
